home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10457 < prev    next >
Encoding:
Text File  |  1996-08-05  |  978 b   |  39 lines

  1. Path: news.nodak.edu!plains!jengel
  2. From: jengel@plains.nodak.edu (John H. Engel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Help with derived class of ifstream class
  5. Date: 8 Mar 1996 03:56:39 GMT
  6. Organization: North Dakota Higher Education Computing Network (NDHECN)
  7. Message-ID: <4hob5n$65c@daily-planet.nodak.edu>
  8. NNTP-Posting-Host: plains.nodak.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=US-ASCII
  11. Content-Transfer-Encoding: 7bit
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. I have been unsuccessful trying to compile the following code:
  15.  
  16. #include <iostream.h>
  17. #include <fstream.h>
  18. class X:public ifstream{
  19. public:
  20.    int read();
  21.    X(char *s):ifstream(s){;};
  22. };
  23.  
  24. int X::read(){
  25.    int i;
  26.    (*this) >> i;        // this is ok
  27.    (*this) >> hex >> i;        // compiler does not like this
  28. };
  29.  
  30. The error I get is 
  31.       no match for 'operator >>(class X, enum ios::{anonymous})'
  32. I am using g++ 2.7. Thanks in advance.
  33.  
  34. --
  35. John Engel
  36. jengel@plains.nodak.edu
  37. http://www.cs.ndsu.nodak.edu/~jengel
  38.  
  39.